home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / includ~1.z / includ~1 / out.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-11  |  3.3 KB  |  122 lines

  1. #ifndef _OUT_H
  2. #define _OUT_H
  3.  
  4. /*
  5.  * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
  6.  * See the copyright notice in the file "../Copyright".
  7.  */
  8. /*
  9.  * output format for ACK assemblers
  10.  */
  11. #ifndef ushort
  12. #define ushort    unsigned short
  13. #endif ushort
  14.  
  15. struct outhead {
  16.     ushort     oh_magic;    /* magic number */
  17.     ushort     oh_stamp;    /* version stamp */
  18.     ushort    oh_flags;    /* several format flags */
  19.     ushort    oh_nsect;    /* number of outsect structures */
  20.     ushort    oh_nrelo;    /* number of outrelo structures */
  21.     ushort    oh_nname;    /* number of outname structures */
  22.     long    oh_nemit;    /* sum of all os_flen */
  23.     long    oh_nchar;    /* size of string area */
  24. };
  25.  
  26. #define O_MAGIC    0x0201        /* magic number of output file */
  27. #define    O_STAMP    0        /* version stamp */
  28. #define MAXSECT    64        /* Maximum number of sections */
  29.  
  30. #define    HF_LINK    0x0004        /* unresolved references left */
  31. #define    HF_8086    0x0008        /* os_base specially encoded */
  32.  
  33. struct outsect {
  34.     long     os_base;    /* startaddress in machine */
  35.     long    os_size;    /* section size in machine */
  36.     long    os_foff;    /* startaddress in file */
  37.     long    os_flen;    /* section size in file */
  38.     long    os_lign;    /* section alignment */
  39. };
  40.  
  41. struct outrelo {
  42.     char    or_type;    /* type of reference */
  43.     char    or_sect;    /* referencing section */
  44.     ushort    or_nami;    /* referenced symbol index */
  45.     long    or_addr;    /* referencing address */
  46. };
  47.  
  48. struct outname {
  49.     union {
  50.       char    *on_ptr;    /* symbol name (in core) */
  51.       long    on_off;        /* symbol name (in file) */
  52.     }    on_u;
  53. #define on_mptr    on_u.on_ptr
  54. #define on_foff    on_u.on_off
  55.     ushort    on_type;    /* symbol type */
  56.     ushort    on_desc;    /* debug info */
  57.     long    on_valu;    /* symbol value */
  58. };
  59.  
  60. /*
  61.  * relocation type bits
  62.  */
  63. #define RELSZ    0x07        /* relocation length */
  64. #define RELO1       1        /* 1 byte */
  65. #define RELO2       2        /* 2 bytes */
  66. #define RELO4       4        /* 4 bytes */
  67. #define RELPC    0x08        /* pc relative */
  68. #define RELBR    0x10        /* High order byte lowest address. */
  69. #define RELWR    0x20        /* High order word lowest address. */
  70.  
  71. /*
  72.  * section type bits and fields
  73.  */
  74. #define S_TYP    0x007F        /* undefined, absolute or relative */
  75. #define S_EXT    0x0080        /* external flag */
  76. #define S_ETC    0x7F00        /* for symbolic debug, bypassing 'as' */
  77.  
  78. /*
  79.  * S_TYP field values
  80.  */
  81. #define S_UND    0x0000        /* undefined item */
  82. #define S_ABS    0x0001        /* absolute item */
  83. #define S_MIN    0x0002        /* first user section */
  84. #define S_MAX    S_TYP        /* last user section */
  85.                 /* ABS = 1, TEXT = 2, DATA = 4, BSS = 5 */
  86. /*
  87.  * S_ETC field values
  88.  */
  89. #define S_SCT    0x0100        /* section names */
  90. #define S_LIN    0x0200        /* hll source line item */
  91. #define S_FIL    0x0300        /* hll source file item */
  92. #define S_MOD    0x0400        /* ass source file item */
  93. #define S_COM    0x1000        /* Common name. */
  94.  
  95. /*
  96.  * structure format strings
  97.  */
  98. #define SF_HEAD        "22222244"
  99. #define SF_SECT        "44444"
  100. #define SF_RELO        "1124"
  101. #define SF_NAME        "4224"
  102.  
  103. /*
  104.  * structure sizes (bytes in file; add digits in SF_*)
  105.  */
  106. #define SZ_HEAD        20
  107. #define SZ_SECT        20
  108. #define SZ_RELO        8
  109. #define SZ_NAME        12
  110.  
  111. /*
  112.  * file access macros
  113.  */
  114. #define BADMAGIC(x)    ((x).oh_magic!=O_MAGIC)
  115. #define OFF_SECT(x)    SZ_HEAD
  116. #define OFF_EMIT(x)    (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
  117. #define OFF_RELO(x)    (OFF_EMIT(x) + (x).oh_nemit)
  118. #define OFF_NAME(x)    (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
  119. #define OFF_CHAR(x)    (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
  120.  
  121. #endif /* _OUT_H */
  122.